﻿using System;
using System.Data;
using System.Collections;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;

namespace BizElements.Core.ProviderComponents
{
    /// <summary>Implements bulk data operations.</summary>
    public interface IBulkSaver
    {
        /// <summary>Saves entity collection.</summary>
        /// <param name="conn">Connection-transaction context.</param>
        /// <param name="table">Target database table.</param>
        /// <param name="entitiesToSave">A collection of entities.</param>
        void BulkSave(IConnectionProvider conn, IDbTable table, IEnumerable entitiesToSave);

        /// <summary>Insert entities.</summary>
        /// <param name="conn">Connection-transaction context.</param>
        /// <param name="table">Target database table.</param>
        /// <param name="newEntities">A collection of entities.</param>
        void BulkInsert(IConnectionProvider conn, IDbTable table, IEnumerable newEntities);

        /// <summary>Updates entities.</summary>
        /// <param name="conn">Connection-transaction context.</param>
        /// <param name="table">Target database table.</param>
        /// <param name="changedEntities">A collection of entities.</param>
        void BulkUpdate(IConnectionProvider conn, IDbTable table, IEnumerable changedEntities);

        /// <summary>Deletes entities.</summary>
        /// <param name="conn">Connection-transaction context.</param>
        /// <param name="table">Target database table.</param>
        /// <param name="removedEntities">A collection of entities.</param>
        void BulkDelete(IConnectionProvider conn, IDbTable table, IEnumerable removedEntities);
    }
}
